﻿using System;
using Newtonsoft.Json.Linq;
using JsonCSharpClassGenerator;

namespace MyVideoTek
{

    internal class Movie
    {

        private JObject __jobject;
        public Movie(JObject obj)
        {
            this.__jobject = obj;
        }

        public int Code
        {
            get
            {
                return JsonClassHelper.ReadInteger(JsonClassHelper.GetJToken<JValue>(__jobject, "code"));
            }
        }

        [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
        private MovieType _movieType;
        public MovieType MovieType
        {
            get
            {
                if(_movieType == null)
                    _movieType = JsonClassHelper.ReadStronglyTypedObject<MovieType>(JsonClassHelper.GetJToken<JObject>(__jobject, "movieType"));
                return _movieType;
            }
        }

        public string OriginalTitle
        {
            get
            {
                return JsonClassHelper.ReadString(JsonClassHelper.GetJToken<JValue>(__jobject, "originalTitle"));
            }
        }

        public string Title
        {
            get
            {
                return JsonClassHelper.ReadString(JsonClassHelper.GetJToken<JValue>(__jobject, "title"));
            }
        }

        public string Keywords
        {
            get
            {
                return JsonClassHelper.ReadString(JsonClassHelper.GetJToken<JValue>(__jobject, "keywords"));
            }
        }

        public int ProductionYear
        {
            get
            {
                return JsonClassHelper.ReadInteger(JsonClassHelper.GetJToken<JValue>(__jobject, "productionYear"));
            }
        }

        [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
        private Nationality[] _nationality;
        public Nationality[] Nationality
        {
            get
            {
                if(_nationality == null)
                    _nationality = (Nationality[])JsonClassHelper.ReadArray<Nationality>(JsonClassHelper.GetJToken<JArray>(__jobject, "nationality"), JsonClassHelper.ReadStronglyTypedObject<Nationality>, typeof(Nationality[]));
                return _nationality;
            }
        }

        [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
        private Genre[] _genre;
        public Genre[] Genre
        {
            get
            {
                if(_genre == null)
                    _genre = (Genre[])JsonClassHelper.ReadArray<Genre>(JsonClassHelper.GetJToken<JArray>(__jobject, "genre"), JsonClassHelper.ReadStronglyTypedObject<Genre>, typeof(Genre[]));
                return _genre;
            }
        }

        [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
        private Release _release;
        public Release Release
        {
            get
            {
                if(_release == null)
                    _release = JsonClassHelper.ReadStronglyTypedObject<Release>(JsonClassHelper.GetJToken<JObject>(__jobject, "release"));
                return _release;
            }
        }

        public int Runtime
        {
            get
            {
                return JsonClassHelper.ReadInteger(JsonClassHelper.GetJToken<JValue>(__jobject, "runtime"));
            }
        }

        public string Synopsis
        {
            get
            {
                return JsonClassHelper.ReadString(JsonClassHelper.GetJToken<JValue>(__jobject, "synopsis"));
            }
        }

        public string SynopsisShort
        {
            get
            {
                return JsonClassHelper.ReadString(JsonClassHelper.GetJToken<JValue>(__jobject, "synopsisShort"));
            }
        }

        [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
        private CastMember[] _castMember;
        public CastMember[] CastMember
        {
            get
            {
                if(_castMember == null)
                    _castMember = (CastMember[])JsonClassHelper.ReadArray<CastMember>(JsonClassHelper.GetJToken<JArray>(__jobject, "castMember"), JsonClassHelper.ReadStronglyTypedObject<CastMember>, typeof(CastMember[]));
                return _castMember;
            }
        }

        [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
        private Poster _poster;
        public Poster Poster
        {
            get
            {
                if(_poster == null)
                    _poster = JsonClassHelper.ReadStronglyTypedObject<Poster>(JsonClassHelper.GetJToken<JObject>(__jobject, "poster"));
                return _poster;
            }
        }

        [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
        private Trailer _trailer;
        public Trailer Trailer
        {
            get
            {
                if(_trailer == null)
                    _trailer = JsonClassHelper.ReadStronglyTypedObject<Trailer>(JsonClassHelper.GetJToken<JObject>(__jobject, "trailer"));
                return _trailer;
            }
        }

        [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
        private Statistics _statistics;
        public Statistics Statistics
        {
            get
            {
                if(_statistics == null)
                    _statistics = JsonClassHelper.ReadStronglyTypedObject<Statistics>(JsonClassHelper.GetJToken<JObject>(__jobject, "statistics"));
                return _statistics;
            }
        }

    }
}
